package com.example.demo02.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo02.entity.Medicine;
import com.example.demo02.mapper.MedicineMapper;
import com.example.demo02.service.MedicineService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class MedicineServiceImpl extends ServiceImpl<MedicineMapper, Medicine> implements MedicineService {
    @Resource
    private MedicineMapper medicineMapper;

    @Override
    public IPage<Medicine> getPage(int pageNum, int size) {
        //参数一是当前页 参数二是每页个数
        IPage<Medicine> medicinePage = new Page<>(pageNum,size);
        System.out.println(medicinePage);
        QueryWrapper<Medicine> qw = new QueryWrapper<>();
        medicinePage = medicineMapper.selectPage(medicinePage,qw);
        return medicinePage;
    }

}
